Quick-add ボタンにアクティブエディタのファイルをリアルタイム表示#49
Merged
Conversation
Add onDidChangeActiveTextEditor listener in extension host to push activeEditor messages to webview. Send initial activeEditor on ready. Add activeEditor type to ExtToWebviewMessage in both extension and webview protocol definitions.
Replace openEditors[0] with activeEditorFile state in InputArea. App.tsx handles activeEditor messages and passes the file to InputArea via props. Quick-add button now reflects the actual active editor.
Update setupWithFiles to send activeEditor message. Add tests for real-time quick-add button update via activeEditor message and null activeEditor hiding the quick-add button.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
対応 Issue
closes #40
概要
入力エリアの quick-add ボタンに、VS Code で現在アクティブなエディタのファイルをリアルタイムで反映するようにした。
やったこと
vscode.window.onDidChangeActiveTextEditorリスナーを追加し、アクティブエディタが変わるたびにactiveEditorメッセージを Webview に送信readyメッセージのハンドラ)でも初期アクティブエディタを送信activeEditorメッセージ型をExtToWebviewMessageに追加(拡張側・Webview 側の両方)activeEditorFileステートを追加し、activeEditorメッセージで更新openEditors[0]の固定表示をやめ、props から渡されるactiveEditorFileを使用やらなかったこと
openEditorsメッセージの廃止(ファイルピッカーで引き続き使用)openEditors[0]へフォールバックする処理(null ならボタン非表示)変更ファイル
src/chat-view-provider.tsactiveEditorメッセージ型追加、onDidChangeActiveTextEditorリスナー登録、getActiveEditorFileメソッド追加webview/vscode-api.tsactiveEditorメッセージ型追加webview/App.tsxactiveEditorFileステート追加、メッセージハンドリング追加webview/components/organisms/InputArea/InputArea.tsxactiveEditorFileを props から受け取り、openEditors[0]の固定表示を削除webview/__tests__/scenarios/07-file-context.test.tsxactiveEditorメッセージ対応、リアルタイム更新テスト追加確認方法